package xuwei_k

case class CommitId(id:String)

case class Commit(id:CommitId,url:String,message:String){
  
  lazy val shortUrl = url //Googl.getShortUrl(url)
  
  lazy val tweetString = {
    (shortUrl + " " + message)
    .replace("@"," ")
    .replace("#"," ")
    .take(140)
  }

}

object Commit{
  def apply(data:xml.Node):Commit =
    Commit(
      CommitId( (data \ "id" ).text )
      , "http://github.com" + (data \ "url" ).text
      ,(data \ "message" ).text
    )
}
